from django.db import models


class Mother(models.Model):
    pass


class Father(models.Model):
    # OneToOneField：定义一对一关系
    # on_delete：定义当关系删除时，需要做的操作
    #   models.DO_NOTHING：表示不做任何操作
    #   models.CASCADE：表示当关系记录删除时，这条也同样删除，级联删除
    wife = models.OneToOneField(Mother, on_delete=models.DO_NOTHING)


class YoungerBrother(models.Model):
    pass


class ElderBrother(models.Model):
    # ForeignKey：定义一对多（多对一）的关系
    # ManyToManyField：定义多对多的关系
    father_id = models.ForeignKey(Father, on_delete=models.DO_NOTHING)
    younger_brother = models.ManyToManyField(YoungerBrother)
    pass
